#ifndef ORDER_H
#define ORDER_H

#include <string>
#include <vector>
#include <boost/random.hpp>
#include <boost/random/random_device.hpp>

namespace customer {

struct Order {
  int table;
  explicit Order(int table) : table(table) {}
};

class OrderSimulator {
  static const int OUTPUT_LIMIT = 4;
  int max_tables;
  boost::random::uniform_int_distribution<> tabledist;
  boost::random::uniform_int_distribution<> outputdist;
  mutable boost::random::random_device rng;

public:
  OrderSimulator(int max_tables): max_tables(max_tables),
    tabledist(0,max_tables-1), outputdist(1,4) {
    if (max_tables < 1) {
      throw std::invalid_argument("invalid number of tables");
    }
  }

  std::vector<Order> getOrders() const {
    // select tables
    std::vector<Order> orders;
    int count = outputdist(rng);
    for (int i = 0; i < count; ++i) {
      int t = tabledist(rng);
      orders.push_back(Order(t));
    }
    return orders;
  }
};

} // namespace customer

#endif
